#!/bin/sh

for i in sed wget patch bzip2 tar wc ; do
	if ! which "$i" >/dev/null 2>&1 ; then
		echo "error: prerequisite $i not found in PATH" >&2
		exit 1
	fi
done

[ -z "$CC" ] && CC=gcc

tmpc=/tmp/tmp$$.c
cat << EOF > "$tmpc"
#include <stdlib.h>
int main () { exit(0); }
EOF
if ! "$CC" -static "$tmpc" -o "$tmpc".out ; then
	rm -f "$tmpc"
	echo "error: could not create static binaries (try installing glibc-static if on fedora)" >&2
	exit 1
fi
rm -f "$tmpc"
rm -f "$tmpc".out

